<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- designer-manual.qdoc -->
  <title>Qt Designer's Buddy Editing Mode | Qt设计师手册</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtdesigner-manual.html">Qt设计师手册</a></td><td >
			<font style="vertical-align: inherit;"><span lang="zh-cn">Qt设计师的伙伴</span>编辑模式</font></td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtdesigner-manual.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="designer-connection-mode.html" />
  <link rel="next" href="designer-tab-order.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="designer-connection-mode.html">Q<span lang="zh-cn">t设计师的信号槽编辑模式</span></a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="designer-tab-order.html">Qt<span lang="zh-cn">设计师的Tab顺序编辑模式</span></a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><span lang="zh-cn">目录</span></h3>
<ul>
<li class="level1"><a href="#linking-labels-to-buddy-widgets">
<span lang="zh-cn">链接Lable（标签）到伙伴组件</span></a></li>
<li class="level1"><a href="#removing-buddy-connections"><span lang="zh-cn">
移除伙伴连接</span></a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title"><font style="vertical-align: inherit;"><span lang="zh-cn">
Qt设计师的伙伴</span>编辑模式</font></h1>
<span class="subtitle"></span>
<!-- $$$designer-buddy-mode.html-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/designer-buddy-mode.png" alt="" /></p><p><font style="vertical-align: inherit;">Qt 最有用的基本功能之一是对伙伴组件的支持。当用户键入标签的快捷键组合时，伙伴组件代表</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/qlabel.html"><font style="vertical-align: inherit;">QLabel</font></a><font style="vertical-align: inherit;">接受输入焦点。Qt 的</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/model-view-programming.html"><font style="vertical-align: inherit;">模型/视图</font></a><font style="vertical-align: inherit;">框架中也使用了伙伴概念。</font></p>
<a name="linking-labels-to-buddy-widgets"></a>
<h2 id="linking-labels-to-buddy-widgets">链接Lable（标签）到伙伴组件</h2>
<p><font style="vertical-align: inherit;">要进入伙伴编辑模式，请打开“</font><b><font style="vertical-align: inherit;">编辑”</font></b><font style="vertical-align: inherit;">菜单并选择“</font><b><font style="vertical-align: inherit;">编辑伙伴”</font></b><font style="vertical-align: inherit;">。此模式以类似于</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/designer-connection-mode.html"><font style="vertical-align: inherit;">信号和插槽编辑模式的</font></a><font style="vertical-align: inherit;">方式在表单上显示组件，但在此模式下，连接必须从标签组件开始。理想情况下，您应该将提供快捷方式的每个标签组件与合适的输入组件（例如</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/qlineedit.html"><font style="vertical-align: inherit;">QLineEdit </font></a>
<span lang="zh-cn">）</span><font style="vertical-align: inherit;"><span lang="zh-cn">连接起来</span>。</font></p>
<a name="makingbuddies"></a><div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/designer-buddy-making.png" alt="" /></td><td >
	 <b><span lang="zh-cn">设置伙伴</span></b><p><font style="vertical-align: inherit;">
	 为标签定义伙伴组件，请单击该标签，将连接拖动到表单上的另一个组件，然后松开鼠标按钮。显示的连接指示输入焦点如何传递给伙伴组件。您可以使用表单预览来测试每个标签与其伙伴之间的联系。</font></p>
</td></tr>
</table></div>
<a name="removing-buddy-connections"></a>
<h2 id="removing-buddy-connections">移除伙伴<span lang="zh-cn">连接</span></h2>
<p><font style="vertical-align: inherit;">每个标签只能定义一个伙伴组件。要更改使用的伙伴，必须在创建新伙伴之前删除任何现有伙伴连接。</font></p>
<p><font style="vertical-align: inherit;">标签及其伙伴组件之间的连接可以与信号和槽编辑模式中的信号槽连接相同的方式删除：通过单击选择伙伴连接，然后按</font><b><font style="vertical-align: inherit;">Delete</font></b><font style="vertical-align: inherit;">键。此操作不会以任何方式修改标签或其伙伴。</font></p>
</div>
<!-- @@@designer-buddy-mode.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="designer-connection-mode.html">Q<span lang="zh-cn">t设计师的信号槽编辑模式</span></a>
<span class="naviSeparator">  &#9702;  
<a class="nextPage" href="designer-tab-order.html">Qt<span lang="zh-cn">设计师的Tab顺序编辑模式</span></a></span>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
